package com.mycompany.user.controller;

import com.mycompany.mvc.utils.BaseResult;
import com.mycompany.user.entity.User;
import com.mycompany.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserAction {

	@Autowired
	private UserService userService;

	/**
	 * app登录
	 * @param user
	 * @return
	 */
	@RequestMapping(value = "/app/login",method = RequestMethod.POST)
	@ResponseBody
	public BaseResult loginApp(@RequestBody User user){
		return userService.loginApp(user);
	}

	/**
	 * app端注册
	 * @param user
	 * @return
	 */
	@RequestMapping(value = "/app/register",method = RequestMethod.POST)
	@ResponseBody
	public BaseResult register(@RequestBody  User user){
		return userService.register(user);
	}

}
